<?php
class CCounterUtils extends Controller{
	
	public static function getinputcounter(){
		$model = Ccounter::model()->findAll();
		$result = "";
		if(count($model) == 0){
			$model = new Ccounter;
			$model->soluonglap = 0;
			$model->online = 0;
			$model->save();			
		}else{
			foreach($model as $item){
				if($item->soluonglap == 10){
					$result = "";
					/*echo $result; */
				}
				break;
			}
			$item->online = $item->online + 1;
			$item->soluonglap = (1+$item->soluonglap) % 11;
			$item->update();
		}
		
		return $result;
	}
}
?>